<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <link href="/styles/base.css" rel="stylesheet" type="text/css">
    <link href="/styles/addtravelnote.css" rel="stylesheet" type="text/css">
    <link href="/styles/public.css" rel="stylesheet" type="text/css">
    <link href="/js/ueditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <link href="/js/plugins/datepicker/datepicker.css" rel="stylesheet">
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.min.js"></script>
    <script type="text/javascript" src="/js/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script src="/js/plugins/datepicker/datepicker.js"></script>
    <script src="/js/plugins/jquery-form/jquery.form.js"></script>



    <link href="/js/plugins/chosen/chosen.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/plugins/chosen/chosen.jquery.js"></script>
    <script type="text/javascript" src="/js/system/common.js"></script>
    <script type="text/javascript" src="/js/system/addtravelnote.js"></script>
    <script type="text/javascript" src="/js/plugins/bootstrap-tagsinput/bootstrap-tagsinput.js"></script>
    <link rel="stylesheet" type="text/css" href="/js/plugins/bootstrap-select/bootstrap-select.css"/>
    <script src="/js/plugins/bootstrap-select/bootstrap-select.js"></script>
    <script>
        $(function () {
            //点击添加封面
            $(".chose_pic").click(function () {
                $("#coverBtn").click();
            })

            $("#coverBtn").change(function () {
                if(this.value){
                    $("#coverForm").ajaxSubmit(function (data) {
                        $(".choseBtn").html(" + 重新选择");
                        $("#coverImage").attr("src", "/" +data);
                        $("#coverValue").val("/" + data);
                    })
                }
            })

            //发表
            $(".btn_submit").click(function () {
                $.get('/userLogin', function (data) {
                    if (data.success) {
                        popup("请先登录");
                        return;
                    }
                    $("#editForm").ajaxSubmit(function (data) {
                            window.location.href ="/problem";
                    })
                })
            });
        });
    </script>
</head>

<body>
<div class="lww_header">
    <div class="header_wrap">
        <div class="header_logo">
            <a href="javascript:;" class="lww_logo"></a>
        </div>
        <ul class="header_nav">
            <li><a href="/">首页</a></li>
            <li><a href="/destination.html">目的地</a></li>
            <li><a href="/gonglve.html">旅游攻略</a></li>
            <li><a href="javascript:;">去旅行<i class="icon_caret_down"></i></a></li>
            <li><a href="javascript:;">游记</a></li>
            <li><a href="javascript:;">酒店</a></li>
            <li><a href="javascript:;">社区<i class="icon_caret_down"></i></a></li>
        </ul>
        <div class="header_search">
            <input type="text"/>
            <a class="icon_search"></a>
        </div>

        <#if userInfo??>
            <div class="login_info">
                <div class="head_user">
                    <a href="/mine/home">
                        <img src="${(userInfo.headImgUrl)!'/images/default.jpg'}"/>
                        <i class="icon_caret_down"></i>
                    </a>
                </div>
                <div class="header_msg">
                    消息<i class="icon_caret_down"></i>
                </div>
                <div class="header_daka">
                    <a href="javascript:;">打卡</a>
                </div>
            </div>
        <#else>
            <div class="login-out">
                <a class="weibo-login" href="#" title="微博登录" rel="nofollow"></a>
                <a class="qq-login" href="#" title="QQ登录" rel="nofollow"></a>
                <a class="weixin-login" href="#" title="微信登录" rel="nofollow"></a>
                <a id="_j_showlogin" title="登录骡窝窝" href="/login.html" rel="nofollow">登录</a>
                <span class="split">|</span>
                <a href="/regist.html" title="注册帐号" rel="nofollow">注册</a>
            </div>
        </#if>
    </div>
    <div class="shadow"></div>
</div>
<div class="wrapper">

    <div class="qt-container clearfix">
        <div class="qt-main">
            <div class="crumb">
                <a href="/problem/">旅游问答</a> &gt; <span>我要提问</span>
            </div>
            <form class="forms" action="/problem/savaOrUpdate" method="post" id="editForm">
                <input type="hidden" name="id"  />
                <div class="qt-tit">
                    <h5>问题标题</h5>
                    <div class="qt-con">
                        <input type="text" placeholder="标题不小于10字哦" class="_j_title" name="title">
                        <span class="count"><span class="_j_title_num">0</span>/80 字</span>
                        <span class="_j_min_num hide">10</span>
                        <span class="error err-tips _j_title_error">标题不能少于10字</span>
                    </div>
                </div>
                <div class="qt-tit">
                    <h5>点击+选择问题图片</h5>
                    <div class="chose_pic">
                        <img src="${(tv.coverUrl)!}" id="coverImage"><span class="choseBtn">+ 选择问题封面</span>
                        <input type="hidden" name="coverUrl" id="coverValue" value="${(tv.coverUrl)!}">
                    </div>
                </div>
                <div class="qt-tit "  >
                    <h5>选择定位地点:</h5>
                    <select name="dest.id" data-placeholder="选择定位地点" id="region"  style="width: 150px;"   >
                        <#list dest as r>
                            <option value="${r.id!}">${r.name!}</option>
                        </#list>
                    </select>

                    <script>
                        $("#region").val(${(tv.dest.id)!});
                    </script>
                </div>
                <div class="form-group">
                    <label for="name" class="col-sm-2 control-label">标签：</label>
                        <input name="tag" id="tagsinputval" class="form-control tagsinput" value="${tag!}"
                               data-role="tagsinput"
                               placeholder="输完后按回车"
                        />

                </div>
                <div class="  body cf">
                    <h5><a title="添加问答内容" class="icon active" id="_j_show_content"></a>问题详细内容</h5>
                    <dd id="content_div">
                        <script id="editor" type="text/plain" style="width:100%;height:500px;"  name="content"></script>
                    </dd>
                </div>
                <div class="publish_question">
                    <div class="accept_pact">
                        <input type="checkbox" checked="">
                        我已阅读并同意<a href="javascript:;" title="《骡窝窝游记协议》" target="_blank">《骡窝窝游记协议》</a>
                    </div>
                    <input class="btn_submit  qt-post-btn" value="发布问题" type="button" >
                </div>
            </form>
        </div>
        <div class="qt-sider">
            <div class="qts-tit">提问的正确姿势</div>
            <div class="qts-con">
                <p>1.问题要【具体】【真实】【诚恳】，问题较多，需全面阐述时，可以添加问题补充。结伴/交易/与旅行无关的提问将被删除。</p>
                <p>2.给问题添加目的地，并打上正确的标签将有助于更快地获得回答。</p>
            </div>
        </div>
    </div>
    <form action="/coverImageUpload" method="post" id="coverForm">
        <input type="file" name="pic" id="coverBtn" style="display: none;">
    </form>
</div>
</body>

</html>